package br.com.guarana.util;

import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

/**
 *
 * @author 
 */
public class JPAHelper {
    
    private static EntityManagerFactory fabrica;

    public static EntityManager createEntityManager() {
        if ((fabrica == null) || (!fabrica.isOpen())) {
            fabrica = Persistence.createEntityManagerFactory("guaranaPU2");
        }
        return fabrica.createEntityManager();
     }
}